﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WJP.Logging;

namespace WJP.Log4Net
{
    /// <summary>
    /// <see cref="Log4NetLogger"/>工厂
    /// </summary>
    [Serializable]
    public class Log4NetLoggerFactory : AbstractLoggerFactory
    {
        /// <summary>
        /// 创建<see cref="ILogger"/>对象
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public override ILogger Create(string name)
        {
            return Create(name, LogLevel.Debug);
        }

        /// <summary>
        /// 创建<see cref="ILogger"/>对象
        /// </summary>
        /// <param name="name"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override ILogger Create(string name, LogLevel level)
        {
            log4net.ILog log = log4net.LogManager.GetLogger(name);
            return new Log4NetLogger(log, level);
        }
    }
}
